﻿#if v49
using System;
using System.IO;
using System.Windows.Forms;
using AxMapWinGIS;
using MapWinGIS;

namespace MapLib.Examples
{
    public partial class MapExamples
    {
        // a label to show result in
        private System.Windows.Forms.ToolStripStatusLabel m_label = null;

        // <summary>
        // Shows attributes of shape in mouse move event.
        // </summary>
        public void ShowAttributes(AxMap axMap1, string dataPath, System.Windows.Forms.ToolStripStatusLabel label)
        {
            dataPath = "";
            Shapefile sf = new Shapefile();

            if (sf != null)
            {
                //sf.HotTracking = true;
                axMap1.CursorMode = tkCursorMode.cmNone;
                //axMap1.ShapeHighlighted += new AxMapWinGIS._DMapEvents_ShapeHighlightedEventHandler(axMap1_ShapeHighlighted);
                m_layerHandle = axMap1.AddLayer(sf, true);
                m_label = label;
            }
        }

        //// <summary>
        //// Handles ShapeHighlighted event and shows attributes of the selected shape in the label
        //// </summary>
        //void axMap1_ShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e)
        //{
        //    Shapefile sf = axMap1.get_Shapefile(e.layerHandle);
        //    if (sf != null)
        //    {
        //        string s = "";
        //        for (int i = 0; i < sf.NumFields; i++)
        //        {
        //            string val = sf.get_CellValue(i, e.shapeIndex).ToString();
        //            if (val == "") val = "null";
        //            s += sf.Table.get_Field(i).Name.ToString() + ":" + val + "; ";
        //        }
        //        m_label.Text = s;
        //    }
        //}
    }
}
#endif